<#assign
regionSelectDirective="com.enation.app.shop.front.tag.goods.other.regions.RegionSelectDirective"?new()>
<script type="text/javascript"
	src="${ctx}/statics/e_tools/js/jquery.addressSelect-1.0.js"></script>

<form id="editor" method="post" class="layui-form">
	<div class="layui-form-item">
		<div class="layui-inline">
			<label class="layui-form-label">用户名：</label>
			<div class="layui-input-inline">
				<input type="text" name="uname" placeholder="请输入" autocomplete="off"
					class="layui-input" value="${member.uname!''}" lay-verify="required" autocomplete="off">
			</div>
		</div>
		<div class="layui-inline">
			<label class="layui-form-label">密码：</label>
			<div class="layui-input-inline">
				<input type="password" name="password" minlength="6" maxlength="18"
					class="layui-input" placeholder="不填则为不修改"
					onkeyup="this.value=this.value.replace(/^ +| +$/g,'')" >
			</div>
		</div>
		<div class="layui-inline">
			<label class="layui-form-label">邮箱：</label>
			<div class="layui-input-inline">
				<input type="text" name="email" value="${(member.email)!''}"
					minlength="6" maxlength="18" class="layui-input" placeholder="" lay-verify="required|email" autocomplete="off">
			</div>
		</div>
		<div class="layui-inline">
			<label class="layui-form-label">昵称：</label>
			<div class="layui-input-inline">
				<input type="text" name="name" value="${(member.name)!''}" lay-verify="required"
					minlength="6" maxlength="18" class="layui-input" placeholder="" autocomplete="off">
			</div>
		</div>
		<div class="layui-inline">
			<label class="layui-form-label">固定电话：</label>
			<div class="layui-input-inline">
				<input type="text" name="tel" value="${(member.tel)!''}"
					minlength="6" maxlength="18" class="layui-input" placeholder="" autocomplete="off">
			</div>
		</div>
		<div class="layui-inline">
			<label class="layui-form-label">移动电话：</label>
			<div class="layui-input-inline">
				<input type="text" name="mobile" value="${(member.mobile)!''}"
					minlength="6" maxlength="18" class="layui-input" placeholder="" lay-verify="required|phone" autocomplete="off">
			</div>
		</div>
		<div class="layui-inline">
			<label class="layui-form-label">邮编：</label>
			<div class="layui-input-inline">
				<input type="text" name="zip" value="${(member.zip)!''}"
					minlength="6" maxlength="18" class="layui-input" placeholder="" autocomplete="off">
			</div>
		</div>
		<div class="layui-inline">
			<label class="layui-form-label">出生日期：</label>
			<div class="layui-input-inline">
				<input name="mybirthday" id="date" lay-verify="required|date"
					value="<@dateformat time='${(member.birthday)!0}' pattern='yyyy-MM-dd'/>"
					placeholder="yyyy-mm-dd" autocomplete="off" class="layui-input"
					onclick="layui.laydate({elem: this})" type="text">
			</div>
		</div>

		<div class="layui-inline">
			<label class="layui-form-label">性别：</label>
			<div class="layui-input-inline">
				<input name="sex" value="1" title="男" <#if member.sex==1>checked="checked"</#if> type="radio">
			    <input name="sex" value="0"  title="女"<#if member.sex==0>checked="checked"</#if> type="radio"> 
			</div>
		</div>

		<#if is_lvmember==1>
		<div class="layui-inline">
			<label class="layui-form-label">会员等级：</label>
			<div class="layui-input-inline">
				<select name="lv_id">
					<option value="">请选择省</option> <#if lvlist??> <#list lvlist as lv>
					<option value="${lv.lv_id }"<#if
						member.lv_id==lv.lv_id>selected</#if> >${lv.name }</option> </#list> </#if>
				</select>
			</div>
		</div>
		</#if>
		
		<div class="layui-inline">
			<label class="layui-form-label">地区</label>
			<div class="layui-input-block" id="selectAddress">
				<script type="text/javascript">
	      			<#if member.province_id ??>
					$(function() {
						$('#selectAddress').addressSelect({
							deData:[   
						           ${member.province_id!''},
	                               ${member.city_id!''},
	                               ${member.region_id!''},
	                               ${member.town_id!''}
					         ]
						});
					})
			<#else>
				$(function() {
					$('#selectAddress').addressSelect();
				})
			</#if>
					</script>
			</div>
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">详细地址：</label>
		<div class="layui-input-block">
			<input type="text" name="address" value="${(member.address)!''}" lay-verify="required"
				minlength="6" maxlength="180" class="layui-input" placeholder="">
		</div>
	</div>
	<input type="hidden" name="member_id" value="${member.member_id}">
	<input type="hidden" name="point" value="${member.point}">
	<div class="layui-form-item" style="width: 100%">
		<div class="layui-input-block">
			<button class="layui-btn" type="submit" lay-submit=""
				lay-filter="save">保存修改</button>
		</div>
	</div>
</form>



<script type="text/javascript">	
var index = parent.layer.getFrameIndex(window.name);
layui.use(['form', 'layedit', 'laydate'], function(){
    var form = layui.form()
        ,layer = layui.layer
        ,layedit = layui.layedit
        ,laydate = layui.laydate;
    //保存修改
    form.on('submit(save)', function(data){
    	
    	if($("input[name='region']").val() === ""|| $("input[name='region']").val() === "-- 请选择 --"){
			$.Loading.show("请选择地区");
			return false;
		}
    	
    	var options = {
    			url:"${ctx}/shop/admin/member/save-edit-member.do",
       			type:"post",
       			dataType:"json",
       			async: false, 
       			success:function(data){
       				if(data.result==1){	      					
       					$.Loading.success(data.message);
       					newTab("会员列表","${ctx}/shop/admin/member/member-list.do");
       				}if(data.result==0){
       					$.Loading.error(data.message);
       				}
       			}
       		};
       		$("#editor").ajaxSubmit(options);
	    return false;
	  });
    form.render();
});
</script>
